package com.cmcc.example.face;

import com.cmcc.example.face.common.vo.ResultVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 * <name>DefaultExceptionCatcher</name>
 * 服务器异常统一捕获处理类
 * </p >
 *
 * @author arabira
 * @version 1.0 2020-04-14
 * @since 1.0
 */
@Slf4j
@ControllerAdvice
public class DefaultExceptionCatcher {

    @ResponseBody
    @ExceptionHandler(value = Exception.class)
    public ResultVO exceptionCacher(Exception e) {
        log.error("统一捕获异常 : {}", e);
        return ResultVO.serverError(e.getMessage());
    }
}